USE CourierDatabase
GO
--create login name
CREATE PROCEDURE CreateLoginName
@loginName VARCHAR(15) OUTPUT
AS
BEGIN
	DEClARE @ID INT
	SET @ID = (SELECT MAX(IDEmp) FROM CourierDatabase.dbo.TempTable)
	SET @loginName = 'EMP' + RIGHT('00000' + CONVERT(VARCHAR(6),@ID),6)
END
GO

--call when add employee success, increase ID in IndexIDEmployee
CREATE PROCEDURE IncreaseIDEmployee
AS
BEGIN
	UPDATE CourierDatabase.dbo.TempTable
	SET IDEmp = IDEmp + 1
END
GO

